package com.qf.java2107.yb.hotel.dao;

import com.qf.java2107.yb.hotel.pojo.Food;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author ghy
 * @version 1.0
 * @date 2021-10-26
 **/
public interface FoodDao {
    /**
     * 增加菜品
     * @param food
     * @throws SQLException
     */
    void save(Food food) throws SQLException;

    /**
     * 查询
     * @param start
     * @param size
     * @param typeId
     * @param foodName
     * @return
     * @throws SQLException
     */
    List<Food> findByCondition(int start, int size, Integer typeId, String foodName) throws SQLException;

    /**
     * 查询
     * @param typeId
     * @param foodName
     * @return
     * @throws SQLException
     */
    Long findByConditionCount(Integer typeId, String foodName) throws SQLException;

    //根据ID查询
    Food findById (Integer id)throws SQLException;

    /**
     * 增加
     * @param food
     * @return
     * @throws SQLException
     */
    int foodAdd(Food food) throws SQLException;

    /**
     * 查询
     * @return
     * @throws SQLException
     */
    List<Map<String, Object>> findAll() throws SQLException;

    /**
     * 删除
     * @param foodId
     * @return
     * @throws SQLException
     */
    int delete(Integer foodId) throws SQLException;

    /**
     * 根据菜品名称模糊查询
     * @return
     */
    List<Food> findLikeName(String typeName) throws SQLException;

    /**
     * 根据菜品名称查询菜系ID
     * @return
     */
    Food findByName(String typeName) throws SQLException;

    void updateFood(Food food) throws SQLException;
}
